using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _MainMaster : System.Web.UI.MasterPage
{
    public string OASSpecialty; 
    
    localFunction lfunc = new localFunction();
    public bool cls = false;
    public string descriptionContent = "";
    public string keywordsContent = "";
    public string titleContent = "FindaDoc.com";
    public bool displayGoogleOnMaster = true;
    public bool displaylnkrankingsystem = false;

    public string TopImg = "";

    /// <summary>
    /// page load event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.FindControl("ctl00$MainTable$btnSubmit") != null)
        {
             form1.DefaultButton = "ctl00$MainTable$btnSubmit";
        } 
        else if (Page.FindControl("ctl00$loginControl$btnSubmit") != null)
        {
             form1.DefaultButton = "ctl00$loginControl$btnSubmit";
        }

        //tbl_feat.InnerText  
        string cur_url = "";
        //GOOGLEADS1.Visible = displayGoogleOnMaster;
        GOOGLEADS2.Visible = displayGoogleOnMaster ? true : false;
      
        if (!IsPostBack)
        {
           
            cls = true;
            //set images for left panel 


            cur_url = Request.Url.ToString();

            if (!(cur_url.Contains("default.aspx")))
            {

                if ((cur_url.Contains("DoctorsDetails")) && !(cur_url.Contains("default.aspx")) && !(cur_url.Contains("doctorlogin.aspx")))
                {
                    tbl_key.Visible = true;
                    tbl_doc.Visible = true;
                }

                if (cur_url.Contains("DentistDetails"))
                {
                    tbl_key.Visible = true;
                    tbl_dent.Visible = true;
                }
                if (cur_url.Contains("ViewBlog"))
                {
                    blogArchiveControl.Visible = true;
                }
                if (cur_url.Contains("BlogDetail"))
                {
                    blogArchiveControl.Visible = true;
                }
                if (cur_url.Contains("blogmessage"))
                {
                    blogArchiveControl.Visible = true;
                }

                if (cur_url.Contains("RateDoctors") || cur_url.Contains("SearchDoctors_adv")
                    || cur_url.Contains("RateDentist") || cur_url.Contains("SearchDentist_adv"))
                {
                    tbl_key.Visible = true;
                }
                if ((cur_url.Contains("blogs")) || (cur_url.Contains("patient_registration"))
                    || (cur_url.Contains("SearchDoctors_adv")) || (cur_url.Contains("SearchDentist_adv")))
                {
                    td_tellfrnd.Visible = true;
                    lnkratingSystem.Visible = displaylnkrankingsystem;
                }

                if (cur_url.Contains("doctorContent"))
                {
                    td_tellcoll.Visible = true;
                }
            }

            if (lfunc.checkUserLogin(false) || lfunc.checkDentistLogin(false) || lfunc.checkDoctorLogin(false))
            {
                lnk_log.Text = "Logout";
                lnkLogin.Text = "Logout";
                lbtnReg.Visible = false;
            }
            else
            {
                lnk_log.Text = "Login";

            }
        }
        FeaturedBox.Visible = this.fVisible;
      

    }

    private bool _fVisible = false;

    public bool fVisible
    {
        get { return _fVisible; }
        set { _fVisible = value; }
    }

    public bool InnerRightBox
    {
        get { return InnerRight.Visible; }
        set { InnerRight.Visible = value; }
    }

    public bool InnerFeatureDocBox
    {
        get { return FeatureDocBox.Visible; }
        set { FeatureDocBox.Visible = value; }
    }

    public bool TdRight
    {
        get { return tdRight.Visible; }
        set { tdRight.Visible = value; }
    }

    public bool TopLoginIMG
    {
        get { return topLoginIMG.Visible; }
        set { topLoginIMG.Visible = value; }
    }


    protected void linkEditDrAccount_Click1(object sender, EventArgs e)
    {
        localFunction lfunction = new localFunction();
        lfunction.checkDoctorLogin(true);
        Session["pageFromOrAction"] = "Edit";
        //R & D 
        //Response.Write(Session["strHttp"]);

        Response.Redirect(Session["strHttps"] + "doctor/doctorRegistration.aspx");
        //Response.Redirect(Session["strHttp"] + "doctor/doctorRegistration.aspx");
    }

    protected void lnk_log_Click(object sender, EventArgs e)
    {
      
        if (lnk_log.Text.ToLower() == "login")
        {
            Session["Clicked"] = "login";
            Response.Redirect(Session["strHttp"] + "default.aspx");
        }
        else
        {
            lfunc.RemoveCookie(localFunction.DOCTORCOOKIE);
            lfunc.RemoveCookie(localFunction.PATIENTCOOKIE);
            lfunc.RemoveCookie(localFunction.DENTISTCOOKIE);

            Session["DoctorType"] = "";
            lfunc.logOffUser();
            lnk_log.Text = "login";
           
        }
    }

    protected void lnk_Reg_Click(object sender, EventArgs e)
    {
        Session["Reg"] = "Register"; 
        Response.Redirect(Session["strHttp"] + "default.aspx");
    }

    protected void Linklogin_Click(object sender, EventArgs e)
    {
        if (lnk_log.Text.ToLower() == "login")
        {
            Session["Clicked"] = "login";
            Response.Redirect(Session["strHttp"] + "default.aspx");
        }
        else
        {
            lfunc.RemoveCookie(localFunction.DOCTORCOOKIE);
            lfunc.RemoveCookie(localFunction.PATIENTCOOKIE);
            lfunc.RemoveCookie(localFunction.DENTISTCOOKIE);
            Session["DoctorType"] = "";
            lfunc.logOffUser();
            lnk_log.Text = "login";

        }
        
    }
}
